import dayjs from 'dayjs';
import { downLoad, request } from '../../../request';

/**
 * 新增
 *
 * @param data
 * @returns
 */
export function addMold(data: any) {
  return request({
    url: '/qms/agv/frock/mold/record/save',
    method: 'post',
    data
  });
}

/** 修改 */
export function updateMold(data: any) {
  return request({
    url: '/qms/agv/frock/mold/record/update',
    method: 'put',
    data
  });
}

/** 删除 */
export function deleteMold(id: any) {
  return request({
    url: `/qms/agv/frock/mold/use/record/delete/${id}`,
    method: 'delete'
  });
}
export function recorddelete(id: any) {
  return request({
    url: `/qms/agv/frock/mold/record/delete/${id}`,
    method: 'delete'
  });
}
/** 报废 */
export function scrapMold(data: any) {
  return request({
    url: '/qms/agv/frock/mold/record/repeal',
    method: 'put',
    data
  });
}

/** 导出 */

export function exportMold(params: any) {
  downLoad({
    url: '/qms/agv/frock/mold/record/export',
    params,
    method: 'get',
    fileName: `冲压模具导出${dayjs().format('YYYY-MM-DD HH:mm:ss')}.xlsx`
  });
}

/** 获取详情列表 */
export function getList(params: any) {
  return request({
    url: '/qms/agv/frock/mold/use/record/list',
    method: 'get',
    params
  });
}

/** 删除详情item */

export function deleteItem(id: any) {
  return request({
    url: `/qms/agv/frock/mold/use/record/delete/${id}`,
    method: 'delete'
  });
}

export function lotNoSearch(lotNo: any) {
  return request({
    url: '/qms/agv/frock/mold/use/record/punchQty',
    method: 'get',
    params: {
      lotNo
    }
  });
}

/** 添加记录 */
export function addRecord(data: any) {
  return request({
    url: '/qms/agv/frock/mold/use/record/save',
    method: 'post',
    data
  });
}
export function moldrecord() {
  return request({
    url: '/qms/agv/frock/mold/record/list?pageNum=1&pageSize=999999',
    method: 'get'
  });
}
